home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / PICTWIND.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  104 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.5  $
  6. //
  7. // Definition of class TPictureWindow
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_PICTWIND_H)
  10. #define OWL_PICTWIND_H
  11.  
  12. #if !defined(OWL_WINDOW_H)
  13. # include <owl/window.h>
  14. #endif
  15.  
  16. #if defined(BI_NAMESPACE)
  17. namespace OWL {
  18. #endif
  19.  
  20. // Generic definitions/compiler options (eg. alignment) preceeding the
  21. // definition of classes
  22. #include <services/preclass.h>
  23.  
  24. class _OWLCLASS TDib;
  25.  
  26. //
  27. // class TPictureWindow
  28. // ~~~~~ ~~~~~~~~~~~~~~
  29. // This class displays a dib in a window in different ways.
  30. // The dib is owned by the window and will be deleted when the window is
  31. // deleted.
  32. //
  33. class _OWLCLASS TPictureWindow : public TWindow {
  34.   public:
  35.  
  36.     // How to display the bitmap within the window
  37.     //
  38.     enum TDisplayHow {
  39.       UpperLeft = 0,      // Upper left corner
  40.       Center,             // Always centered
  41.       Stretch,            // Stretch to fit or shrink to fit
  42.       // Scroll,             // implies Upperleft  
  43.     };
  44.  
  45.     // constructor and destructor
  46.     //
  47.     TPictureWindow(TWindow* parent, TDib* dib, TDisplayHow = UpperLeft,
  48.                const char far* title = 0, TModule* module = 0);
  49.    ~TPictureWindow();
  50.  
  51.     // Use new dib and return old dib
  52.     //
  53.     TDib*       SetDib(TDib* newDib);
  54.     TDib*       GetDib() const;
  55.  
  56.     void        SetHowToDisplay(TDisplayHow how);
  57.     TDisplayHow GetHowToDisplay() const;
  58.  
  59.     // overridden from TWindow for CS_HREDRAW and CS_VREDRAW
  60.     //
  61.     char far* GetClassName();
  62.     void      GetWindowClass(WNDCLASS& wndClass);
  63.  
  64.   protected:
  65.     void Paint(TDC& dc, bool erase, TRect& rect);
  66.  
  67.   private:
  68.     TDib* Dib;
  69.     TDisplayHow HowToDisplay;
  70. };
  71.  
  72. // Generic definitions/compiler options (eg. alignment) following the
  73. // definition of classes
  74. #include <services/posclass.h>
  75.  
  76. #if defined(BI_NAMESPACE)
  77. } // namespace OWL
  78. #endif
  79.  
  80. //----------------------------------------------------------------------------
  81. // Inline implementations
  82. //
  83.  
  84. //
  85. // Return the dib.
  86. //
  87. inline TDib*
  88. TPictureWindow::GetDib() const
  89. {
  90.   return Dib;
  91. }
  92.  
  93. //
  94. // Return how the picture is displayed.
  95. //
  96. inline TPictureWindow::TDisplayHow
  97. TPictureWindow::GetHowToDisplay() const
  98. {
  99.   return HowToDisplay;
  100. }
  101.  
  102.  
  103. #endif  // OWL_PICTWIND_H
  104.